<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>do-while</title>
</head>
<body>
    <button onclick="funDo()">跑二十圈</button>
    <button onclick="funSum()">100的和</button>
    <button onclick="funSum()">100的和</button>
    <button onclick="funEven()">100中偶数的和</button>
    <button onclick="funContinue()">跳过周三</button>
    <button onclick="funBreak()">周三结束</button>
    <button onclick="funA()">1x9</button>
    <button onclick="funB()">乘法表</button>
</body>
    <script>
        function funDo(){
            var i = 1
            do {
                console.log("跑了" + i + "圈")
                i++
            }
            while (i<=20)
        }
        function funSum(){
            var i = 1
            var sum = 0
            do{
                sum += i
                i++
            }
            while (i<=100)
            console.log(sum)
        }
        function funEven(){
            var i = 1
            var sum = 0
            do{
                if (i%2==0){
                    sum += i
                }
                i++
            }
            while (i<=100)
            console.log(sum)
        }
        function funContinue(){
            var i =1
            do {
                if (i == 3){
                    i++
                    continue
                }
                console.log("今天周" + i)
                i++
            }
            while (i<=7)
        }
        function funBreak(){
            var i = 1
            do{
                if (i == 3){
                    break
                }
                console.log("今天周" + i)
                i++
            }
            while (i<=7)
        }
        function funA(){
            var i =1,j=1
            do {
                console.log(i + "*" + j + "=" + i*j)
                j++
            }
            while (j<=9)
        }
        function funB() {
            var i = 1
            do{
                var j = 1
                do {
                    document.write(i + "*" + j + "=" + i*j + "\t")
                    j++
                }
                while (j<=i)
                document.write("<br>")
                i++
            }
            while (i<=9)
        }
    </script>
</html>